package test1;

import static org.lwjgl.opengl.GL11.*;

import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.*;
import org.lwjgl.*;

public class LWJGLHelloWorld
{
	/*********************************** BEGIN CONSTANTS *******************************************/
	public static final int WIDTH = 800;
	public static final int HEIGHT = 600;
	public static final int ZNEAR = 1;

	/*********************************** END CONSTANTS *******************************************/

	public LWJGLHelloWorld()
	{
		try
		{
			Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
			Display.setTitle("Hello, LWJGL!");
			Display.create();
		} catch (LWJGLException e)
		{
			e.printStackTrace();
		}

		// Initialize OpenGL
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glOrtho(0, WIDTH, HEIGHT, 0, ZNEAR, -1);
		glMatrixMode(GL_MODELVIEW);

		while (!Display.isCloseRequested())
		{
			glClear(GL_COLOR_BUFFER_BIT);
			
			glBegin(GL_QUADS);
			glVertex2i(400,400);
			glVertex2i(500,400);
			glVertex2i(500,500);
			glVertex2i(400,500);
			glEnd();
			
			glBegin(GL_LINES);
			glVertex2i(100, 100);
			glVertex2i(200, 200);
			glEnd();

			Display.update();
			Display.sync(60);
		}
		Display.destroy();
	}

	public static void main(String[] args)
	{
		new LWJGLHelloWorld();

	}
	
	private int GetMouseDY()
	{
		return -Mouse.getDY();
	}

	private int GetMouseY()
	{
		return HEIGHT - Mouse.getY() - 1;
	}

}
